package Login;

import Dbutils.Dbutils;

import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;

public class Login {
    public boolean Login(String name,String password){
        Connection con = Dbutils.Connect();
        boolean flag = false;
        String sql = "select * from userinformation where userName = (?)and password =(?)";
        PreparedStatement ppst = Dbutils.getPrepareStatement(con, sql);
        try {
            ppst.setString(1,name);
            ppst.setString(2,password);
            ResultSet rs = ppst.executeQuery();
            if(rs.next()){
                flag=true;
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }
        return flag;
    }
}
